package com.chixing.service.impl;

import com.chixing.mapper.CustomerMapper;
import com.chixing.pojo.Customer;
import com.chixing.pojo.CustomerExample;
import com.chixing.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: wtl
 * @Date: 2021/10/09/0:25
 * @Description:
 */
@Service
public class CustomerServiceImpl implements CustomerService {
    @Autowired
    private CustomerMapper customerMapper;
    @Override
    public Customer login(Long custTelno, String custPassword) {
        CustomerExample example = new CustomerExample();
        example.createCriteria().andCustTelnoEqualTo(custTelno).andCustPasswordEqualTo(custPassword);
        List<Customer> customer = customerMapper.selectByExample(example);
        Customer customer1 = customer.get(0);
        if(custTelno.equals(customer1.getCustTelno())&&custPassword.equals(customer1.getCustPassword())){
            return customer1;
        }
        return null;
    }


}
